package empty.users;

import java.io.Serializable;
import java.util.Objects;

public class User implements Serializable {

    private int id;
    private String name;
    private String gender;
    private int age;
    private int phone;
    private String address;

    private String pwd;
    private int manger;
    private int department_id;

    public User() {
    }

    public User(int id, String name, String gender, int age, int phone, String address, String pwd, int manger, int department_id) {
        this.id = id;
        this.name = name;
        this.gender = gender;
        this.age = age;
        this.phone = phone;
        this.address = address;
        this.pwd = pwd;
        this.manger = manger;
        this.department_id = department_id;
    }

    public User(String name, String pwd) {
        this.name = name;
        this.pwd = pwd;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getPhone() {
        return phone;
    }

    public void setPhone(int phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public int getManger() {
        return manger;
    }

    public void setManger(int manger) {
        this.manger = manger;
    }

    public int getDepartment_id() {
        return department_id;
    }

    public void setDepartment_id(int department_id) {
        this.department_id = department_id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return id == user.id && age == user.age && phone == user.phone && manger == user.manger && department_id == user.department_id && Objects.equals(name, user.name) && Objects.equals(gender, user.gender) && Objects.equals(address, user.address) && Objects.equals(pwd, user.pwd);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, gender, age, phone, address, pwd, manger, department_id);
    }

    public Object [] toArray(){
        return new Object[] {
            id, name, gender, age, phone, address, pwd, manger, department_id
        };
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", gender='" + gender + '\'' +
                ", age=" + age +
                ", phone=" + phone +
                ", address='" + address + '\'' +
                ", pwd='" + pwd + '\'' +
                ", manger=" + manger +
                ", department_id=" + department_id +
                '}';
    }
}
